namespace lucere.index.write
{
    /// <summary>
    /// Used by DocumentsWriter to maintain per-thread state.
    /// We keep a separate Posting hash and other state for each
    /// thread and then merge postings hashes from all threads
    /// when writing the segment.
    /// </summary>
    public interface IDocumentsWriterThreadState
    {
        /// <summary>
        /// false if this is currently in use by a thread
        /// </summary>
        bool IsIdle { get; set; }

        /// <summary>
        /// Number of threads that share this instance
        /// </summary>
        int NumThreads { get; set; } 
        
        /// <summary>
        /// true if we should flush after processing current doc
        /// </summary>
        bool DoFlushAfter { get; set; }

        IDocumentConsumerPerThread Consumer { get; set; }

        IDocumentState DocState { get; } 

        IDocumentsWriter DocWriter { get; } 

        void DoAfterFlush();
    }
}